Texture mapping is a technique for shading surfaces of three-dimensional (3-D) objects with texture patterns when rendering the objects, typically, onto a two-dimensional (2-D) display screen whose pixels are indexed by (x, y) coordinates. Applying textures to surfaces of 3-D objects can produce realistic images. For example, applying a wood grain texture to a desk surface produces a more realistic object than simply shading the surface with a uniform color. To model such a complex surface as a multitude of small triangles, however, each with a slightly different color, requires too many triangles to render efficiently. Instead, the surface is modeled with a small number of triangles, and pre-computed texture images or photos are mapped onto the triangles.
Texture data samples representing the texture image are stored in data elements called texels, organized as an array called a texture map. Each texel is a point that is usually associated with color and transparency information, but may be associated with data that affects surface normal vectors ("bump mapping") or with data that affects the surface position ("displacement mapping"). Texels are indexed by (u, v) coordinates for 2-D textures, or (u, v, w) coordinates for 3-D textures.
When a 3-D object is rendered on the display screen, the pixel data are modified by the texture data. To determine which texture data affect a given pixel, a filter is placed over the pixel and projected onto the texture map, producing a footprint of the pixel filter on the texture map in (u, v) coordinates. This pixel filter footprint is then approximated by a filter that is efficient to implement. Those texels covered by the approximating filter are read, weighted, and accumulated; the result then modifies the display value of that pixel.
Some filtering techniques such as point sampling and bilinear filtering, for example, emphasize simplicity and efficiency at the cost of visual quality. These techniques use information only about the projection of the center of the filter onto the texture map and ignore the size and shape of the resulting footprint. Point sampling, for instance, projects the center of a given pixel to a (u, v) point in the texture map, rounds the u and v coordinates to the nearest integer, and uses the texture data at the integer coordinates to determine the texture for that pixel. However, this filter does a poor job of rejecting high frequencies that cannot be reproduced on the display screen, producing objectionable artifacts as a result.
Like point sampling, bilinear filtering also projects the center of the pixel onto the texture map, but uses a 2 by 2 square texel linear filter that covers up to four texels. The covered texels are read, weighted, and accumulated. The weight applied to each covered texel is linearly related to the horizontal u and vertical v distances of that covered texel from the center of the filter. Although this wider filter coverage and distance-based weighting substantially improves the visual quality over point sampling, bilinear filtering can still produce artifacts when neighboring pixels on the display project to widely separated texels in the texture map. This occurs when the projection of a pixel filter maps to a large footprint in texel coordinates containing many more than the four texel samples that are bilinearly filtered.
This led to the development of a texture filtering technique called trilinear mip-mapping. Central to this technique is the mip-map, which stores the texture image at varying levels of resolution or detail (LOD). During rendering, mip-mapping computes a real lod value that determines which two levels of detail closely resemble the scale of the projected pixel and reads texels at those levels. Trilinear mip-mapping, for example, selects two adjacent levels of detail, bilinearly filters four texels from each of the two selected levels, and linearly weights and averages the two bilinear texel values. The weight given to each of the bilinear texel values depends on the relative closeness of each level of detail from which the texels were read to the computed lod value.
Trilinear mip-mapping, however, can still produce blurred or aliased textures for surfaces that are obliquely angled away from the viewer. These problems arise because trilinear mip-mapping, like other space-invariant isotropic filtering methods such as point sampling and bilinear filtering, approximate the projection of the pixel filter onto the texture map with a footprint that has the same symmetrical shape and orientation for each pixel in the image. In practice, however, projections of the pixel filter onto a texture map can produce footprints that, from pixel to pixel, vary in size, shape, orientation, and position. The single filter footprint shape and orientation in texture space used by isotropic filtering methods like bilinear filtering and trilinear mip-mapping may poorly approximate the area covered by these true projected footprints. Another problem with bilinear and trilinear texture mapping is the square filter footprint in screen coordinates. In general, circular filters in screen coordinates, which map to ellipses in texture coordinates, require processing fewer texels than square filters for an equivalent level of visual quality.
Ideal texture mapping, then, should use a circular pixel filter projected onto texture maps. Ideal texture mapping should also be anisotropic (i.e., space-variant) and vary the size, shape, and orientation of the filter used to sample the texels in order to better approximate the elliptical footprints produced by projecting the circular pixel filters. One technique, the Elliptical Weighted Average (EWA) filter, closely approximates the size, shape, and orientation of the projected elliptical footprint. Each texel is evaluated to determine whether it is inside a bounding area that contains the ellipse. All texels inside the ellipse are sampled, weighted, and accumulated. The resulting value is divided by the volume of the elliptical filter in texture coordinates. The complexity of EWA, though, has precluded hardware implementation thus far.
Others have attempted to simplify this complexity by using a series of trilinear filtering operations, but these techniques have considered the computation of the exact ellipse parameters to be too difficult and costly to implement, and instead have used poor approximations of the ellipse parameters. Generally, these approximations underestimate the length of the major axis of the ellipse, introducing unnecessary aliasing, and overestimate the length of the minor axis, introducing unnecessary blurring. Further, such approximations can substantially deviate from the slope of the major axis, which introduces even more blurring and aliasing. While such methods may simplify computations, their results are of noticeably inferior visual quality when compared to the EWA.
Thus, a method and an apparatus are needed for performing anisotropic texture mapping that can vary the attributes of a filter according to the projected pixel filter footprint and produce clearer images without introducing aliasing artifacts and becoming computationally burdensome or mathematically complicated.